use super::*;

/// A [Feature](https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#feature-table).
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy)]
pub struct Feature<'a> {
	pub tag: Tag,
	pub lookup_indices: LazyArray16<'a, LookupIndex>,
}

impl<'a> RecordListItem<'a> for Feature<'a> {
	fn parse(tag: Tag, data: &'a [u8]) -> Option<Self> {
		let mut s = Stream::new(data);
		let _params_offset = s.read::<Offset16>()?; // Unsupported.
		Some(Self {
			tag,
			lookup_indices: s.parse_array16()?,
		})
	}
}
